<template>
  <div class="myCenter-container">
    <div class="userhead">
      <img :src="src" alt>
      <span>{{username}}</span>
    </div>
    <!-- 下面的是我们的收藏 优惠券 订单 客服 -->

    <div class="main">
      <div @click="setUp" class="mainbox boxjiushi">
        <div class="mainfbox">
          <img src="@/assets/img/icon_sz_grzx.png" class="mainicon">
          <span>设置</span>
        </div>
        <img src="@/assets/img/icon_grzx_xl.png" class="righticon">
      </div>
      
      <div class="mainbox boxjiushi" @click="resetpassword">
        <div class="mainfbox">
          <img src="@/assets/img/icon_xgnc_mima.png" class="mainicon">
          <span>修改密码</span>
        </div>
        <img src="@/assets/img/icon_grzx_xl.png" class="righticon">
      </div>

      <div class="mainbox boxjiushi" @click="tobind">
        <div class="mainfbox">
          <img src="@/assets/img/icon_ddxqzf_zfb.png" class="mainicon">
          <span>绑定支付宝</span>
        </div>
        <img src="@/assets/img/icon_grzx_xl.png" class="righticon">
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      username: "Admin",
      src: require("@/assets/img/img_tx_grzx.png")
    };
  },
  activated(){
    this.getlist()
  },
  created: function() {
    this.getlist()
  },
  methods: {
    getlist(){
      let that = this;
    console.log(123)
    var obj = {
      id: localStorage.getItem("userid")
    };
    that.axios
      .post(that.baseUrl + "/user/queryUser", that.Qs.stringify(obj), {
        headers: {
          "Content-Type": "application/x-www-form-urlencoded"
        }
      })
      .then(function(res) {
        if (res.request.status === 200) {
          console.log(res.data);
          if (res.data.meta.code == 200) {
            that.src = res.data.data.head;
            that.username = res.data.data.name;
          } else {
            console.log("fail");
          }
        }
      });
    },
    tobind(){
        this.$router.push({
            name:'bind'
        })
    },
    resetpassword(){
        this.$router.push({
            name:'resetpassword'
        })
    },
    // 下面的是到我的订单去
    setUp() {
      this.$router.push({
        name: "modifying"
      });
    },
  }
};
</script>
<style lang="scss" scoped>
.myCenter-container {
  width: 100%;
  height: 100%;
  background: #f4f4f4;
}

.boxjiushi {
  width: 90%;
  margin: 0 auto;
}

.righticon {
  width: 9px;
  height: 18px;
  vertical-align: middle;
  margin-left: 10px;
}

.header {
  background: #fff;
  padding: 10px 5%;
}

.userhead {
  width: 100%;
  text-align: center;
  font-size: 18px;
  padding-top: 15px;
  padding-bottom: 15px;
  background: #ffffff;
}
.userhead > img {
  display: block;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  margin: 0 auto;
  margin-bottom: 5px;
}
.btn {
  width: 90%;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  padding-top: 10px;
  padding-bottom: 10px;
  margin-top: 15px;
  margin-bottom: 15px;
}
.btn > div {
  width: 25%;
  float: left;
  text-align: center;
  font-size: 14px;
}
.btn > div > img {
  display: block;
  width: 50%;
  margin: 0 auto;
  margin-bottom: 5px;
}
.btn:after {
  content: ".";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}
.userinfo {
  display: inline-block;
  vertical-align: middle;
  margin-left: 5px;
}
span {
  color: #737373;
}
.username {
  font-size: 18px;
}

.bannerbox {
  width: 88%;
  margin: 0 auto;
}

.listicon {
  width: 50px;
  height: 50px;
  margin-bottom: 3px;
}

.banner {
  padding: 12px 0;
  overflow: hidden;
}

.bannerbox {
  display: flex;
  justify-content: space-around;
}

.sbox {
  display: inline-block;
  text-align: center;
  .listtit {
    color: #1fadff;
  }
}

.main {
  background: #fff;
  .mainfbox {
    display: inline-block;
  }
  .mainbox {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f4f4f4;
  }
  .righticon {
    margin-right: 20px;
  }
  .mainicon {
    width: 28px;
    height: 28px;
    vertical-align: middle;
  }
  span {
    display: inline-block;
    font-size: 17px;
    line-height: 17px;
    height: 100%;
    vertical-align: middle;
    line-height: 100%;
    margin-left: 15px;
  }
}
</style>

